//
//  MCStatusBottomView.swift
//  HXWeibo
//
//  Created by HX on 15/12/3.
//  Copyright © 2015年 HX. All rights reserved.
//

import UIKit

class MCStatusBottomView: UIView
{
    required init?(coder aDecoder: NSCoder)
    {
        fatalError("init(coder:) has not been implemented")
    }
    
    override init(frame: CGRect)
    {
        super.init(frame: frame)
        
        prepareUI()
    }
    
    private func prepareUI()
    {
        backgroundColor = UIColor(white: 0.98, alpha: 1)
        // 添加子控件
        addSubview(forwardBtn)
        addSubview(commentBtn)
        addSubview(unlikeBtn)
        addSubview(lineImageView1)
        addSubview(lineImageView2)
        
        // 添加约束
        // 平铺子控件
        self.ff_HorizontalTile([forwardBtn, commentBtn, unlikeBtn], insets: UIEdgeInsetsZero)
        
        lineImageView1.ff_AlignHorizontal(type: ff_AlignType.CenterRight, referView: forwardBtn, size: nil)
        lineImageView2.ff_AlignHorizontal(type: ff_AlignType.CenterRight, referView: commentBtn, size: nil)
        
    }

    func addBtn(btn: UIButton, imageName: String, titleName: String)
    {
        //按钮图片
        btn.setImage(UIImage(named: imageName), forState: UIControlState.Normal)
        
        //按钮文字
        btn.setTitle(titleName, forState: UIControlState.Normal)
        
        //文字颜色
        btn.setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
        
        //文字大小
        btn.titleLabel?.font = UIFont.systemFontOfSize(12)
    }
    
    // MARK: - 懒加载
    /// 转发按钮
    private lazy var forwardBtn : UIButton = UIButton(imageName: "timeline_icon_retweet", title: "转发")
    
    /// 评论按钮
    private lazy var commentBtn: UIButton = UIButton(imageName: "timeline_icon_comment", title: "评论")

    /// 赞按钮
    private lazy var unlikeBtn: UIButton = UIButton(imageName: "timeline_icon_unlike", title: "赞")
    
    private lazy var lineImageView1: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line_highlighted"))
    private lazy var lineImageView2: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line_highlighted"))
}

































